import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '是否可用',
		align: "center",
		dataIndex: 'stats',
		customRender: ({ text }) => {
			if (text == false) {
				return '可用'
			} else {
				return '不可用'
			}
		}
	},
	{
		title: '领队等级',
		align: "center",
		dataIndex: 'agentid_dictText'
	},
	{
		title: '领队等级',
		align: "center",
		dataIndex: 'levnum',
		customRender: ({ text }) => {
			return 'LV.' + text
		}
	},
	{
		title: '每天薪资（分）',
		align: "center",
		dataIndex: 'daysalary',
		customRender: ({ text }) => {
			return text / 100;
		}
	},
	{
		title: '说明',
		align: "center",
		dataIndex: 'extinfors',
		customRender: ({ text }) => {
			if (text != "{}") {
				return JSON.parse(text).msg
			}else{
				return ''
			}
		}
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
];
//表单数据
export const formSchema : FormSchema[] = [
	{
		label: '是否可用',
		field: 'stats',
		component: 'JDictSelectTag',
		componentProps: {
			options: [
				{ label: '可用', value: 'false' },
				{ label: '不可用',value: 'true' },
			],
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入是否删除：false：可用，true：不可用!' },
			];
		},
	},
	{
		label: '领队等级',
		field: 'agentid',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: 'sys_category,name,id,pid="1724609796876804098"'
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入领队等级!' },
			];
		},
	},
	/*  {
		label: '领队等级',
		field: 'levnum',
		component: 'InputNumber',
		dynamicRules: ({model,schema}) => {
			  return [
					 { required: true, message: '请输入领队等级!'},
			  ];
		 },
	  }, */
	{
		label: '每天工资',
		field: 'daysalary',
		component: 'InputNumber',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true },
				{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },
			];
		},
	},
	{
		label: '说明',
		field: 'msg',
		component: 'InputTextArea',
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}